Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

methmeth

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

methmeth

Execute a method out from an object.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
58K
decreased by-34.87%
Maintainers
1
Weekly downloads
 
Created
Source

methmeth

Call a method on an object in an Array.prototype callback.

$ npm install --save methmeth
var meth = require('methmeth');

var friends = [
  {
    name: 'passy',
    hobby: 'carrots',
    getInfo: function () {
      return this.name + ' likes ' + this.hobby;
    }
  },
  {
    name: 'sindre',
    vehicle: 'unicorn taxi',
    getInfo: function () {
      return this.name + ' drives a ' + this.vehicle;
    }
  },
  {
    name: 'addy',
    invented: 'google *',
    getInfo: function () {
      return this.name + ' created ' + this.invented;
    }
  }
];
Before
var myFriends = friends.map(function (item) {
  return item.getInfo();
}).join('\n');
// passy likes carrots
// sindre drives a unicorn taxi
// addy created google *
After
friends.map(meth('getInfo')).join('\n');
// passy likes carrots
// sindre drives a unicorn taxi
// addy created google *
Pre-fill arguments
var friends = [
  {
    name: 'dave',
    passion: 'dried mango',
    getInfo: function (emotion) {
      return this.name + ' loves ' + this.passion + emotion;
    }
  }
];

friends.map(meth('getInfo', '!!!!')).join('\n');
// dave loves dried mango!!!!
  • propprop - Pluck a property out of an object in an Array.prototype callback.

Keywords

FAQs

Package last updated on 30 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc